home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_apache2.idb / usr / freeware / apache2 / build / instdso.sh.z / instdso.sh
Linux/UNIX/POSIX Shell Script  |  2002-07-08  |  2KB  |  71 lines

  1. #!/bin/sh
  2. #
  3. # instdso.sh - install Apache DSO modules
  4. #
  5. # we use this instead of libtool --install because:
  6. # 1) on a few platforms libtool doesn't install DSOs exactly like we'd
  7. #    want (weird names, doesn't remove DSO first)
  8. # 2) we never want the .la files copied, so we might as well copy
  9. #    the .so files ourselves
  10.  
  11. if test "$#" != "3"; then
  12.     echo "wrong number of arguments to instdso.sh"
  13.     echo "Usage: instdso.sh SH_LIBTOOL-value dso-name path-to-modules"
  14.     exit 1
  15. fi
  16.  
  17. SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'`
  18. DSOARCHIVE=$2
  19. DSOARCHIVE_BASENAME=`basename $2`
  20. TARGETDIR=$3
  21. DSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
  22. TARGET_NAME="$DSOBASE.so"
  23.  
  24. SYS=`uname -s`
  25.  
  26. if test "$SYS" = "AIX"
  27. then
  28.     # on AIX, shared libraries remain in storage even when
  29.     # all processes using them have exited; standard practice
  30.     # prior to installing a shared library is to rm -f first
  31.     CMD="rm -f $TARGETDIR/$TARGET_NAME"
  32.     echo $CMD
  33.     $CMD || exit $?
  34. fi
  35.  
  36. CMD="$SH_LIBTOOL --mode=install cp $DSOARCHIVE $TARGETDIR/"
  37. echo $CMD
  38. $CMD || exit $?
  39.  
  40. if test "$SYS" = "OS/2"
  41. then
  42.     # on OS/2, aplibtool --install doesn't copy the .la files & we can't
  43.     # rename DLLs to have a .so extension or they won't load so none of the 
  44.     # steps below make sense.
  45.     exit 0
  46. fi
  47.  
  48. DLNAME=`grep "^dlname" $TARGETDIR/$DSOARCHIVE_BASENAME | sed -e "s/dlname='\([^']*\)'/\1/"`
  49. LIBRARY_NAMES=`grep "library_names" $TARGETDIR/$DSOARCHIVE_BASENAME | sed -e "s/dlname='\([^']*\)'/\1/"`
  50. LIBRARY_NAMES=`echo $LIBRARY_NAMES | sed -e "s/ *$DLNAME//g"`
  51.  
  52. if test -n "$LIBRARY_NAMES"
  53. then
  54.     for f in $LIBRARY_NAMES
  55.     do
  56.         rm -f $TARGETDIR/$f
  57.     done
  58. fi
  59.  
  60. if test "$DLNAME" != "$TARGET_NAME"
  61. then
  62.     mv $TARGETDIR/$DLNAME $TARGETDIR/$TARGET_NAME
  63. fi
  64.  
  65. rm -f $TARGETDIR/$DSOARCHIVE_BASENAME
  66. rm -f $TARGETDIR/$DSOBASE.a
  67. rm -f $TARGETDIR/lib$DSOBASE.a
  68. rm -f $TARGETDIR/lib$TARGET_NAME
  69.  
  70. exit 0
  71.